import os,sys
os.chdir(r"C:\Users\cai\Desktop\光电竞赛迷宫寻宝\neural_net_classify")

from conv_net import ConvNet
from common.trainer import Trainer
from data_deal import loaddatas


network = ConvNet()
x_train, t_train = loaddatas()
x_test, t_test =loaddatas()
x_train=x_train.transpose(0,3,1,2)
x_test=x_test.transpose(0,3,1,2)
#network.load_params("1.pkl")
#m=network.show_wrong_data(x_train,t_train)
#network.accuracy(x_test,t_test)
trainer = Trainer(network, x_train, t_train, x_test, t_test,
                  epochs=666, mini_batch_size=10,
                  optimizer='adam', lr=0.0006,
                  evaluate_sample_num_per_epoch=None)


trainer.train()

# 保存参数
network.save_params("deep_convnet_params.pkl")
print("Saved Network Parameters!")
